const gulp=require('gulp');
const less=require('gulp-less');
const cssmin=require('gulp-minify-css');
const imagemin=require('gulp-imagemin');
const autoprefixer = require('gulp-autoprefixer');

gulp.task('less',function () {
    gulp.src('public/less/*.less')
        .pipe(less())
        .pipe(autoprefixer({
            browsers: ['last 5 versions'],
            cascade: false
        }))
        .pipe(cssmin())
        .pipe(gulp.dest('public/css'));

});

gulp.task('watchLess',function () {
   gulp.watch('public/less/*.less',['less']) ;
});

gulp.task('image', function () {
    gulp.src('public/images/*.{png,jpg,gif,ico}')
        .pipe(imagemin({
            progressive: true,
            svgoPlugins: [{removeViewBox: false}]
        }))
        .pipe(gulp.dest('public/img'));
});
